package com.mz.ozy.mvp.presenter;

import android.content.Context;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.ArticleTypeListBean;
import com.mz.ozy.mvp.model.ArticleModel;
import com.mz.ozy.mvp.view.StrategyTypeContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;

/**
 * Created by administrator on 2018/12/3.
 */
public class StrategyTypePresenter extends BasePresenterImpl<StrategyTypeContract.View> implements StrategyTypeContract.Presenter {

    private ArticleModel mArticleModel;

    public StrategyTypePresenter() {
        mArticleModel = new ArticleModel();
    }

    @Override
    public void queryArticleType(Context context) {
        mArticleModel.queryArticleType(context)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<ArticleTypeListBean>(mView){

                    @Override
                    public void onSuccesss(ArticleTypeListBean listBean) {
                        mView.getArticleType(listBean);
                    }
                });
    }
}
